package test.com.dcivision.framework;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Properties;
import java.util.Set;

import org.apache.struts.util.MessageResources;
import org.apache.struts.util.MessageResourcesFactory;

public class DcivisionMessageResources extends MessageResources {

  public DcivisionMessageResources(MessageResourcesFactory arg0, String arg1) {
    super(arg0, arg1);
    formats = new HashMap();
    Properties tt = new Properties();
    String string = "D:\\Projects\\EIP\\EIP\\So urce\\src\\com\\dcivision\\resource\\ApplicationResources.properties";
    File file = new File(string);
    InputStream in = null;
    try {
      in = new FileInputStream(file);
      tt.load(in);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    //    formats=tt.keys();
    //    Enumeration ttt=tt.elements();
    Set keySet = tt.keySet();
    for (Iterator iter = keySet.iterator(); iter.hasNext();) {
      String element = (String) iter.next();
      formats.put(element, tt.getProperty(element));
    }

    //    formats.p
    // TODO Auto-generated constructor stub
  }

  public String getMessage(Locale locale, String key) {
    // TODO Auto-generated method stub
    return (String)formats.get(key);
  }

}
